project(navmesh)

if(CMAKE_SYSTEM_NAME MATCHES "Windows")
    add_definitions(-DLUA_BUILD_AS_DLL)
endif()

add_definitions(-DLUA_LIB)

set(CMAKE_CXX_STANDARD 17)

include_directories(../recastnavigation/Detour/Include)
include_directories(../recastnavigation/DetourCrowd/Include)
include_directories(../recastnavigation/DetourTileCache/Include)
include_directories(../recastnavigation/Recast/Include)
include_directories(../fastlz)
include_directories(.)
include_directories(../../hive/3rd/lua)

aux_source_directory(../recastnavigation/Detour/Source DETOUR_SOURCE)
aux_source_directory(../recastnavigation/DetourCrowd/Source DETOURCROWD_SOURCE)
aux_source_directory(../recastnavigation/DetourTileCache/Source DETOURTILECACHE_SOURCE)
aux_source_directory(../recastnavigation/Recast/Source RECAST_SOURCE)
aux_source_directory(../fastlz FASTLZ_SOURCE)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} NAVMESH_SOURCES)

add_library(navmesh SHARED ${DETOUR_SOURCE} ${DETOURCROWD_SOURCE} ${DETOURTILECACHE_SOURCE} ${RECAST_SOURCE} ${FASTLZ_SOURCE} ${NAVMESH_SOURCES})
target_link_libraries(navmesh liblua mimalloc)